<?php

/**
 * @author SNOWTAM
 * @purpose Graph of temperature by time with flash graph component.       
 * @created 2008-12-26
 */

	require("config/db_config_dt.php");
	$connection = mysql_connect($db_host, $db_user, $db_password) or die("Unable to connect");
	mysql_select_db($db_name, $connection);

//start the XML output 
print "<chart>";
print "<chart_type>line</chart_type>";
print "
<axis_category size='8' alpha='75' orientation='vertical_down' margin='false' />
<axis_value size='10' color='000000' alpha='50' show_min='' />



";

print "<chart_data>";

//output the first row that contains the years 
print "<row>";
print "<null/>";
$lvs_query = "select date,time,temperature from wx_data WHERE (minute(time)=0) ORDER BY date DESC, time DESC LIMIT 24";

$result = mysql_query($lvs_query);
	for ( $i=0; $i < mysql_num_rows($result); $i++ ) 
		{
			print "<string>".mysql_result( $result, $i, 1)."</string>";
			//echo "<br>$result";
		}
print "</row>";

print "<row>";
print "<string>Temperatur vid Storstugan - 24 timmar</string>"; 

	for ($i=0; $i < mysql_num_rows($result); $i++)
	{
		$tooltip = mysql_result($result, $i, 2);
		print "<number tooltip='$tooltip'>".mysql_result($result, $i, 2)."</number>";	
		//echo "<br>$tooltip";
		
	}
print "</row>";

//finish the XML output 
print "</chart_data>";
print 
"
<chart_border top_thickness='1' bottom_thickness='1' left_thickness='1' right_thickness='1' />
<chart_grid_h alpha='10' thickness='1' type='solid' />
<chart_grid_v alpha='10' thickness='1' type='solid' />
<chart_guide horizontal='false' thickness='1' color='ffffff' alpha='50' type='dashed' radius='3' line_color='FFFF00' line_alpha='75' line_thickness='2' text_color='FFFF00' text_h_alpha='90' />	

<chart_pref line_thickness='2' point_shape='none' fill_shape='false' />

<series_color>
<color>002AFF</color>
</series_color>



";
print "</chart>";

?>